const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    setupMiddlewares(middlewares, devServer)
    {
      if (!devServer)
        throw new Error('webpack-dev-server is not defined')
      return middlewares
    },
    proxy: {
      // 配置代理规则
      '/node': {
        target: 'http://localhost:3000', // 目标服务器地址
        changeOrigin: true, // 允许跨域
        pathRewrite: {
          '^/node': '' // 将 /node 前缀去掉
        }
      }
    }
  }
})
